import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '流程名称',
    align:"center",
    dataIndex: 'name'
   },
/*   {
    title: '审核策略',
    align:"center",
    dataIndex: 'method'
   },*/
  {
    title: '部门',
    align:"center",
    dataIndex: 'departId_dictText'
  },
  {
    title: '流程类型',
    align:"center",
    dataIndex: 'eventType_dictText'
  },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '流程名称',
    field: 'name',
    component: 'Input',
/*    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入流程名称!'},
          ];
     },*/
    show:({values})=>{
      if(values && values.id)
      return true;
      else
        return false;
    },
    dynamicDisabled:true,
  },

  {
    label: '部门',
    field: 'departId',
    component: 'JSelectDept',
    componentProps:{
      checkStrictly:false,
      multiple:false
    }
  },
  {
    label: '流程类型',
    field: 'eventType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"audit_event",
      //stringToNumber: true
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '流程类型!'},
      ];
    },
  },
  {
    label: '审核策略',
    field: 'method',
    component: 'Input',
    show:false,
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '申请类型名称',order: 0,view: 'text', type: 'string',},
  method: {title: '审核策略',order: 1,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
